<?php


if(!isset($_SESSION))
{
   session_start();
}

if( !function_exists('__autoload') )
{
    function __autoload($class_name) {
    require_once $class_name . '.php';
    }
}

SAEO::ValidarAcesso( array( 0, 2 ) );


$ano = new Ano();
$anosCadastrados = $ano->CarregarAnos() # carrega do banco de dados todos os anos cadastrados e retorna o resultado em um array
?>
<html>
           <head>
           <title>SAEO - Buscar Plano Interno</title>
           <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
           <script type='text/javascript' src='templates/programa.js'></script>
           <script type='text/javascript' src='templates/campus.js'></script>
           <script type='text/javascript' src='templates/setor.js'></script>
           <script type='text/javascript' src='templates/reserva.js'></script>
           <script type='text/javascript' src='templates/fonte.js'></script>
           <script type='text/javascript' src='templates/hintbox.js'></script>
           <script type='text/javascript' src='templates/js.js'></script>
           <script type='text/javascript' src='templates/ajax.js'></script>
           <script type='text/javascript' src='templates/validacoes.js'></script>
           <link rel='stylesheet' type='text/css' href='templates/estilos.css'/>
           <link type='text/css'' href='templates/jquery/css/ui-lightness/jquery-ui-1.8.2.custom.css' rel='stylesheet'' />
           </head>
     <body class='body' onload=''>
     <form name='buscar_reserva' id='buscar_reserva' action='ListarReserva.php' method='get' onsubmit=''>
     <table width='779' border='0' cellspacing='0' cellpadding='0' align='center' bgcolor='#FFFFFF'>
            <tr>
                <td colspan='2'><?php include "Topo.php"; ?></td>
            </tr>
            <tr>
                <td colspan='2'><div class='titulosTabelas' style='width:779; height:20; background:url(templates/tabela.jpg)'>EXCLUIR DE PLANO INTERNO</div></td>
            </tr>
            <?php
            	if(isset($_GET['erro'])){
            ?>	
            		<tr>
                		<td colspan='2'>&nbsp;</td>
            		</tr>
            		<tr>
               	 		<td colspan='2'><div class='titulosTabelas' style='color:red; font-size:13px; width:779; height:20; background:url(templates/tabela.jpg)'> <?php echo $_GET['erro']; ?> </div></td>
            		</tr>
             <?php
            	} 
             ?>
            
            <tr>
                <td colspan='2'>&nbsp;</td>
            </tr>
            <tr>
                <td colspan='2'>
               
                        <table id='dadosFornecedor' width='650' border='0' cellpadding='0' align='center' bgcolor='#FFFFFF' class='detalhamento'>
						<thead class='detalhamento'>
						<tr>
							<th>Codigo</th>
							<th>Título</th>
							<th>Operações</th>
						</tr>
						</thead>
						<tbody class='detalhamento' id='corpoPrograma'>
						<?php 
							$planoInternoDAO = new PlanoInterno();
							$planoInternoArray = $planoInternoDAO->ConsultarTodos();

							
								if(!$planoInternoArray){
						?>
							<tr>
								<td colspan="6" class="textoCentral">Não existe nenhum Plano Interno cadastrado</td>
							</tr>
						<?php 
							}else{
								foreach ($planoInternoArray as $planoInterno){
						?>
									<tr>
										<td align="center" style='width: 100px;'><?php echo $planoInterno->cod; ?></td>
										<td><?php echo $planoInterno->titulo; ?></td>
										<td align="center" style='width: 100px;'><a onclick="return confirm('Confirma exclusão do Plano Interno número <?php echo $planoInterno->cod;?>? ')" title="excluir Plano Interno" href="ExcluirPlanoInterno.php?cod=<?php echo $planoInterno->cod; ?>"><img style="border: 0;" src="templates/b_drop.png" /></a></td>
									</tr>
						<?php 
								}
							}
						?>
                        </tbody>
						
					</table>
					
                </td>
            </tr>
            <tr>
                <td colspan='2'>&nbsp;</td>
            </tr>
            <tfoot>
                   <tr>
                   		<td><?php include 'rodapeCreditos.php'; ?></td>
                   </tr>
            </tfoot>
     </table>
     </form>
     </body>
     </html>
